home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
catn
/
glob.n
< prev
next >
Wrap
Text File
|
1994-09-20
|
3KB
|
133 lines
glob(n) Tcl Built-In Commands 7.0
_________________________________________________________________
NAME
glob - Return names of files that match patterns
SYNOPSIS
glob ?_s_w_i_t_c_h_e_s? _p_a_t_t_e_r_n ?_p_a_t_t_e_r_n ...?
_________________________________________________________________
DESCRIPTION
This command performs file name ``globbing'' in a fashion
similar to the csh shell. It returns a list of the files
whose names match any of the _p_a_t_t_e_r_n arguments.
If the initial arguments to glob start with - then they are |
treated as switches. The following switches are currently |
supported: |
-nocom- |
plain ||
Allows an empty list to be returned without |
error; without this switch an error is |
returned if the result list would be empty. |
-- ||
Marks the end of switches. The argument fol- |
lowing this one will be treated as a _p_a_t_t_e_r_n |
even if it starts with a -.
The _p_a_t_t_e_r_n arguments may contain any of the following spe-
cial characters:
? Matches any single character.
* Matches any sequence of zero or more characters.
[_c_h_a_r_s] Matches any single character in _c_h_a_r_s. If _c_h_a_r_s
contains a sequence of the form _a-_b then any char-
acter between _a and _b (inclusive) will match.
\_x Matches the character _x.
{_a,_b,...} Matches any of the strings _a, _b, etc.
As with csh, a ``.'' at the beginning of a file's name or
just after a ``/'' must be matched explicitly or with a {}
construct. In addition, all ``/'' characters must be
matched explicitly.
If the first character in a _p_a_t_t_e_r_n is ``~'' then it refers
to the home directory for the user whose name follows the
Tcl 1
glob(n) Tcl Built-In Commands 7.0
``~''. If the ``~'' is followed immediately by ``/'' then
the value of the HOME environment variable is used.
The glob command differs from csh globbing in two ways.
First, it does not sort its result list (use the lsort com-
mand if you want the list sorted). Second, glob only |
returns the names of files that actually exist; in csh no |
check for existence is made unless a pattern contains a ?, |
*, or [] construct.
KEYWORDS
exist, file, glob, pattern
Tcl 2